<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .sty01{
            font-size: 30px;
            color: red;
        }
    </style>
    <script src="js/react.development.js"></script>
    <script src="js/react-dom.development.js"></script>
    <script src="js/babel.min.js"></script>
</head>
<body>
    <div id="root"></div>
    <script type="text/babel">
        let iNum01  = 10;
        let str = "abcdefg";
        let ok = false;
        let url = "http://www.baidu.com"
        function fnRev(s) {
            return s.split('').reverse().join('');
        }
        let e1 = (
                <div>
                    <h2>jsx语法</h2>
                    {/*放表达式*/}
                    <p>{iNum01+5}</p>

                    {/*放变量*/}
                    <p>{ str }</p>

                    {/*放函数*/}
                    <p>{ str.split('').reverse().join('') }</p>

                    {/*放自定义函数*/}
                    <p>{ fnRev(str) }</p>

                    {/*三目运算表达式*/}
                    <p>{ ok?'YES':'NO' }</p>

                    {/*jsx的注释只能这么些*/}

                    {/*链接写法1*/}
                    <a href={url}>这是个链接</a>

                    {/* class属性使用className替换*/}
                    <a href={url} className = "sty01">这是个链接</a>
                </div>
            )
        ReactDOM.render(
            e1,
            document.getElementById("root")
        )
    </script>
</body>
</html>